﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PMisuseAn.behaviour.model
{
    [Serializable()]
    public class Transition
    {
        int transitionID_;
        string transitionName_;
        string startState_;
        string endState_;
        string associatedEevent_;
        string machineName_;
        string clusterName_;
        public List<string> policyIDs;

        bool isMitigationPoint_;
        bool isMisusePoint_;
        bool isCallable_;
        int mitigationSeqRefIndex_;

        public Event activeEvent;

        public Transition()
        {
            policyIDs = new List<string>();
        }

        public int mitigationSeqRefIndex
        {
            get
            {
                return mitigationSeqRefIndex_;
            }
            set
            {
                mitigationSeqRefIndex_ = value;
            }
        }

        public int transitionID
        {
            get
            {
                return transitionID_;
            }
            set
            {
                transitionID_ = value;
            }
        }

        public bool isMitigationPoint
        {
            get
            {
                return isMitigationPoint_;
            }
            set
            {
                isMitigationPoint_ = value;
            }
        }

        public bool isMisusePoint
        {
            get
            {
                return isMisusePoint_;
            }
            set
            {
                isMisusePoint_ = value;
            }
        } 

        public void addPolicyID(string policyID)
        {
            policyIDs.Add(policyID);
        }

        public void removePolicyPD(string policyID)
        {
            foreach (string p in policyIDs)
            {
                if (p.Equals(policyID))
                {
                    policyIDs.Remove(p);
                    break;
                }
            }
        }
        
        public string clusterName
        {
            get
            {
                return clusterName_;
            }
            set
            {
                clusterName_ = value;
            }
        }

        public string transitionName
        {
            get
            {
                return transitionName_;
            }
            set
            {
                transitionName_ = value;
            }
        }

        public string startState
        {
            get
            {
                return startState_;
            }
            set
            {
                startState_ = value;
            }
        }

        public string endState
        {
            get
            {
                return endState_;
            }
            set
            {
                endState_ = value;
            }
        }

        public string associatedEevent
        {
            get
            {
                return associatedEevent_;
            }
            set
            {
                associatedEevent_ = value;
            }
        }

        public string machineName
        {
            get
            {
                return machineName_;
            }
            set
            {
                machineName_ = value;
            }
        }

        public bool isCallable
        {
            get
            {
                return isCallable_;
            }
            set
            {
                isCallable_ = value;
            }
        }
    }
}
